{"ast":null,"code":"import _objectSpread from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import React from'react';import{observer}from\"mobx-react-lite\";import{Context}from\"../index\";import{GetUserDialog as GetUserDialogComponent}from\"../components\";import{browserRouteIm}from\"../routes\";import{useNavigate}from\"react-router-dom\";import{jsx as _jsx}from\"react/jsx-runtime\";import{Fragment as _Fragment}from\"react/jsx-runtime\";var GetUserDialog=function GetUserDialog(props){var _React$useContext=React.useContext(Context),store=_React$useContext.store;var navigate=useNavigate();var handleOnClick=function handleOnClick(){store.getDialogOrNewFromAPI(props.profile).then(function(chat){if(chat){store.setCurrentDialog(_objectSpread(_objectSpread({},store.getCurrentDialog()),chat));store.setViewedDialogId(chat.id);navigate(browserRouteIm);}});};if(!props.selfProfile){return/*#__PURE__*/_jsx(GetUserDialogComponent,{callback:handleOnClick});}else{return/*#__PURE__*/_jsx(_Fragment,{});}};export default observer(GetUserDialog);","map":{"version":3,"names":["React","observer","Context","GetUserDialog","GetUserDialogComponent","browserRouteIm","useNavigate","props","useContext","store","navigate","handleOnClick","getDialogOrNewFromAPI","profile","then","chat","setCurrentDialog","getCurrentDialog","setViewedDialogId","id","selfProfile"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/containers/GetUserDialog.tsx"],"sourcesContent":["import React from 'react';\nimport {observer} from \"mobx-react-lite\";\nimport {Context} from \"../index\";\nimport {GetUserDialog as GetUserDialogComponent} from \"../components\";\nimport {UserProfileProps} from \"../models/props/UserProfileProps\";\nimport {browserRouteIm} from \"../routes\";\nimport {useNavigate} from \"react-router-dom\";\n\nconst GetUserDialog: React.FC<UserProfileProps> = (props) => {\n    const {store} = React.useContext(Context);\n    const navigate = useNavigate();\n\n    const handleOnClick = () => {\n        store.getDialogOrNewFromAPI(props.profile).then((chat) => {\n            if (chat) {\n                store.setCurrentDialog({\n                    ...store.getCurrentDialog(),\n                    ...chat\n                });\n                store.setViewedDialogId(chat.id);\n                navigate(browserRouteIm);\n            }\n        });\n    }\n\n    if (!props.selfProfile) {\n        return (\n            <GetUserDialogComponent callback={handleOnClick} />\n        );\n    } else {\n        return (<></>);\n    }\n}\n\nexport default observer(GetUserDialog);"],"mappings":"6IAAA,MAAOA,MAAK,KAAM,OAAO,CACzB,OAAQC,QAAQ,KAAO,iBAAiB,CACxC,OAAQC,OAAO,KAAO,UAAU,CAChC,OAAQC,aAAa,GAAIC,uBAAsB,KAAO,eAAe,CAErE,OAAQC,cAAc,KAAO,WAAW,CACxC,OAAQC,WAAW,KAAO,kBAAkB,CAAC,gGAE7C,GAAMH,cAAyC,CAAG,QAA5CA,cAAyC,CAAII,KAAK,CAAK,CACzD,sBAAgBP,KAAK,CAACQ,UAAU,CAACN,OAAO,CAAC,CAAlCO,KAAK,mBAALA,KAAK,CACZ,GAAMC,SAAQ,CAAGJ,WAAW,EAAE,CAE9B,GAAMK,cAAa,CAAG,QAAhBA,cAAa,EAAS,CACxBF,KAAK,CAACG,qBAAqB,CAACL,KAAK,CAACM,OAAO,CAAC,CAACC,IAAI,CAAC,SAACC,IAAI,CAAK,CACtD,GAAIA,IAAI,CAAE,CACNN,KAAK,CAACO,gBAAgB,gCACfP,KAAK,CAACQ,gBAAgB,EAAE,EACxBF,IAAI,EACT,CACFN,KAAK,CAACS,iBAAiB,CAACH,IAAI,CAACI,EAAE,CAAC,CAChCT,QAAQ,CAACL,cAAc,CAAC,CAC5B,CACJ,CAAC,CAAC,CACN,CAAC,CAED,GAAI,CAACE,KAAK,CAACa,WAAW,CAAE,CACpB,mBACI,KAAC,sBAAsB,EAAC,QAAQ,CAAET,aAAc,EAAG,CAE3D,CAAC,IAAM,CACH,mBAAQ,kBAAK,CACjB,CACJ,CAAC,CAED,cAAeV,SAAQ,CAACE,aAAa,CAAC"},"metadata":{},"sourceType":"module"}